package com.test.model;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.util.Date;
import java.util.Set;

/**
 * 
 * @author zxw
 * create 2016年3月7日 上午10:43:11
 */
@Entity
@Table(name="rcc_e_houseMeter")
public class HouseMeter extends EquModel {
	private Integer uniqueId;
    private String serialNo;
    private Integer caliber;
    private Model model;
    private Collector collector;
    private Integer port;
    private Integer index;
    private Date installDate;
    private Date createDate;
    private House house;
    private StationBranch stationBranch;
    private String memo;
    private String detailPosition;
	private NetEqu netEqu;
    private Set<HouseMeterCurrentData> houseMeterCurrentData;
  //  private Set<HouseMeterHistoricalData> houseMeterHistoricalData;
    private String equState;
	private Dictionary equProblem;
    @Id
    @GeneratedValue
    @Column(name = "uniqueId", unique = true, nullable = false)
	public Integer getUniqueId() {
		return uniqueId;
	}
	public void setUniqueId(Integer uniqueId) {
		this.uniqueId = uniqueId;
	}
	@Column(name = "serialNo")
	public String getSerialNo() {
		return serialNo;
	}
	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}
	 @Column(name = "caliber")
	public Integer getCaliber() {
		return caliber;
	}
	public void setCaliber(Integer caliber) {
		this.caliber = caliber;
	}
	 @ManyToOne(fetch = FetchType.LAZY)
	 @JoinColumn(name = "modelId")
	public Model getModel() {
		return model;
	}
	public void setModel(Model model) {
		this.model = model;
	}
	 @ManyToOne(fetch = FetchType.LAZY)
	 @JoinColumn(name = "collectorId")
	public Collector getCollector() {
		return collector;
	}
	public void setCollector(Collector collector) {
		this.collector = collector;
	}
	 @Column(name = "`port`")
	public Integer getPort() {
		return port;
	}
	public void setPort(Integer port) {
		this.port = port;
	}
	 @Column(name = "`index`")
	public Integer getIndex() {
		return index;
	}
	public void setIndex(Integer index) {
		this.index = index;
	}
	@Column(name = "installDate")
	public Date getInstallDate() {
		return installDate;
	}
	public void setInstallDate(Date installDate) {
		this.installDate = installDate;
	}
	 @Column(name = "createDate")
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	 @ManyToOne(fetch = FetchType.LAZY)
	 @JoinColumn(name = "houseId")
	public House getHouse() {
		return house;
	}
	public void setHouse(House house) {
		this.house = house;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	 @JoinColumn(name = "stationBranchId")
	public StationBranch getStationBranch() {
		return stationBranch;
	}
	public void setStationBranch(StationBranch stationBranch) {
		this.stationBranch = stationBranch;
	}
	@Column(name = "memo")
	public String getMemo() {
		return memo;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	 @Column(name = "detailPosition")
	public String getDetailPosition() {
		return detailPosition;
	}
	public void setDetailPosition(String detailPosition) {
		this.detailPosition = detailPosition;
	}
	
	@OneToMany(mappedBy = "houseMeter")
	public Set<HouseMeterCurrentData> getHouseMeterCurrentData() {
		return houseMeterCurrentData;
	}
	public void setHouseMeterCurrentData(
			Set<HouseMeterCurrentData> houseMeterCurrentData) {
		this.houseMeterCurrentData = houseMeterCurrentData;
	}
	@Column(name = "equState")
	public String getEquState() {
		return equState==null?"可用":equState;
	}

	public void setEquState(String equState) {
		this.equState = equState;
	}


	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "equProblem")
	@NotFound(action = NotFoundAction.IGNORE)
	public Dictionary getEquProblem() {
		return equProblem;
	}

	public void setEquProblem(Dictionary equProblem) {
		this.equProblem = equProblem;
	}
	@ManyToOne(fetch = FetchType.LAZY )
	@JoinColumn(name = "netEquId")
	public NetEqu getNetEqu() {
		return netEqu;
	}

	public void setNetEqu(NetEqu netEqu) {
		this.netEqu = netEqu;
	}


//	@OneToMany(mappedBy = "houseMeter" ,fetch = FetchType.LAZY )
//	public Set<HouseMeterHistoricalData> getHouseMeterHistoricalData() {
//		return houseMeterHistoricalData;
//	}
//
//	public void setHouseMeterHistoricalData(Set<HouseMeterHistoricalData> houseMeterHistoricalData) {
//		this.houseMeterHistoricalData = houseMeterHistoricalData;
//	}
}
